package com.mfw.springboot.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.mfw.springboot.common.DataGroupByDateDTO;
import com.mfw.springboot.model.dto.announcement.AnnouncementQueryRequest;
import com.mfw.springboot.model.entity.Announcement;
import com.mfw.springboot.model.vo.AnnouncementVO;

import javax.servlet.http.HttpServletRequest;

import java.util.Date;
import java.util.List;

/**
 * 公告信息服务
 *
 * @author mfw
 * @from <a href="https://gitee.com/hanhuaifei/projects">我的gitee</a>
 * @Date 2024/9/26
 */
public interface AnnouncementService extends IService<Announcement> {

    /**
     * 校验数据
     *
     * @param announcement
     * @param add 对创建的数据进行校验
     */
    void validAnnouncement(Announcement announcement, boolean add);

    /**
     * 获取查询条件
     *
     * @param announcementQueryRequest
     * @return
     */
    QueryWrapper<Announcement> getQueryWrapper(AnnouncementQueryRequest announcementQueryRequest);
    
    /**
     * 获取公告信息封装
     *
     * @param announcement
     * @param request
     * @return
     */
    AnnouncementVO getAnnouncementVO(Announcement announcement, HttpServletRequest request);

    /**
     * 分页获取公告信息封装
     *
     * @param announcementPage
     * @param request
     * @return
     */
    Page<AnnouncementVO> getAnnouncementVOPage(Page<Announcement> announcementPage, HttpServletRequest request);

    /**
    * 分按日期分组查询公告信息新增数量
    *
    * @param beginDate 开始时间
    * @param endDate   结束时间
    * @return
    */
    List<DataGroupByDateDTO> countByDay(Date beginDate, Date endDate);
}
